package com.korion.android.devicedemon.base

import android.content.Context

object LocalSettings {

    const val KEY_REMOTE_PHONE = "remote_phone"
    const val KEY_PUSH_APP_ID = "push_app_id"
    const val KEY_PUSH_APP_SECRET = "push_app_secret"
    const val KEY_PUSH_OPEN_ID = "push_open_id"
    const val KEY_PUSH_ACCESS_TOKEN = "push_access_token"
    const val KEY_ACCESS_TOKEN_EXPIRED = "access_token_expired"

    private val localSettings = AppContextProvider.getAppContext().getSharedPreferences("local_settings", Context.MODE_PRIVATE)

    fun getString(key: String, defValue: String? = null): String? {
        return localSettings.getString(key, defValue)
    }

    fun saveString(key: String, value: String) {
        localSettings.edit().putString(key, value).apply()
    }
}